package com.shadowtorcher.dragonstreasure.until;


import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.Date;

public class Until {
    public static Date decryptDate(String str) {
        String dateString = String.valueOf(Integer.parseInt(str, 36));
        try {
            return new SimpleDateFormat("YYYYMMddHH").parse(dateString);
        } catch (ParseException e) {
            e.printStackTrace();
        }
        return new Date();
    }

    public static String encryptDate(Date date) {
        String dateString = new SimpleDateFormat("YYYYMMddHH").format(date);
        int i = Integer.valueOf(dateString, 10);
        return Integer.toString(i, 36).toUpperCase();
    }
}
